#!/usr/bin/node

const http=require('http'),
      url=require('url'),
      qs=require('querystring'),
      log=console.log;


let  addr='http://wangding:123@www.baidu.com:8080/a/b/c?age=20&gender=M#/d/e/f';

//parse转换为一个对象
addr=url.parse(addr);
console.log('addr',addr);

log(addr.protocol);

log(addr.username);
log(addr.password);
log(addr.hostname);
log(addr.port);
log(addr.pathname);
log(addr.query);
log(addr.hash);

//将name=fumei sno=2018022032解析为对象
log(qs.parse(addr.query));
